refactored a little, not sure if I helped