Refactored and cleaned up classes