got rid of nasty case statements