get rid of nasty case statement