work on database preprocessing code