reorganize code into files