working needless repetitions soln