Move stuff into function.