better function names and fixed Firefox bug.