Refactored input and added Makefile