cleaned up and refactored chart view