converted into javascript library, blah