refactoring to allow multiple statements under if