fixed y
lots of small corrections and improvements