Moving code around & cleanup.