begin converting to jquery plugin