modularize extract method to patterns