Change order of conditional blocks so that return statement is last