moved logic to jquery plugin