Refactored into methods