cleaned up modular code