cleaned up switch statement