Refactor everyting into separate files