split up/organized code, made changes to Makefile as appropriate