Cleaned up some if statements, replacing them with case when.