Added easy-to-use functions and refactoring