Clean up and organizing for better abstraction.