course work and some refactoring