General clean up. Splitting things into methods.