More functions and refactoring