Move some things into methods/functions