Added documentation
Reformatted using Netbeans