working code based off HackMIT-Fairview 2014