Fail early pattern to get rid of messy if statements and indentation