Enhancing javascript with additional methods