refactored and cleaned up classes