Source cleaned up and added jQuery checking