re-org code into multiple files, main file was getting unmanageable