wrote assoc++ and refactored helper functions