state to separate files

broke the state function out into separate files.