cleaned up classes to reduce duplicate code