fix firefox bugs, annotation tweaks and refactor