added some comments and organization to the main file