Moved some things into helpers

& generally cleaned stuff up