Updated to run on jQuery