Clean up if-else tree with cond