Generalized some functions, implemented record delete. Minor fixes