added more functions and documentation