Make branching logic cleaner