Added make file and fixed some bugs so it compiles