refactor methods
move functions to bottom with @philwills