refactored to make things look prettier