Prevent user from opening or saving to folder name and minor code cleanup.