refactored to small methods