Various UI JS Enhancements

Some refactoring and error handling for the Comment Image Handler logic