Refactor build system and allow for optimization on files