Clean up comments and functions

remove unused logic and correct, hide menu items based on file type and
enable based on contents.