moved code around into separate files to make more organized