conversion to use only javascript