Made it compile using makefiles, took longer than I thought. Still needs to be refactored in places.