Code cleanup (less nesting)