added functins to clean up table and fixed wrong schema def in records.