Added documentation for the main function