MAESTRO-2791 fixed empty elsif and tweaked validate function to by more DRY