updated plugin to be jQuery compatible