Added some documentation. Some code refactoring was made.