jquery version
cleaned up code