Added basics of -contour support. db still needed, also some other changes in this commit.