Hoisted a few functions so Firefox would find them at the right time