Added DB functionality and edit functionality