Clean up code, extract method.