Added documentation
Formatted code