final changes for display and duplicate bug in DB insertion