refactoring out jquery crud