refactroed if/else statements - grouped by path instead of method