refactored multiples methods in solution1