refactored filterMethods method