logic moved to a method