Refactored: extracted various methods