Changed to actual JavaScript implementation.