fixed all bugs, improved overall performance
added test cases, ans key, and dictionary