Clean up of requires and general refactoring.