Comments

Added comments and reorganized code to be more readable

Also removed code to delete and recreate file as it was a duplicate of what was already being done in the same method