useful comment :D

fixed bugs, cleaned up code