Extract some methods, rename others, remove whitespace