Added some more functions and comments