Refactored to make things look good