Cleaned up numerous duplicate rediculous if statements with a single
helper function.