Fixedd bug with Firefox e.offsettX, small refactoring