edited comments etc.
simplified some methods