why use so many if statements when you could have done this more elegant using $iif and comparing based on \'<\' and \'>\'