Added functions and documentation