refactored to 2 methods