Firefox Compatibility

IMPORTANT: all of these changes are specifically to make Firefox work.
Even though they do not look great, they are important.