Refactored various methods for easier reading