Added code to change file permissions, removed empty line, added comments to part where existence of file is checked