Cleaned up the jQuery implementation