unify js implementation
update readme and bump to 0.4.0