cleaned code, added more functionality, and fixed bugs