reordered javascript