Added a little documentation and tested functions.