Sebastian Scatularo - Added documentation and fixed something related to non existent array index