Added db reference and creates array to later input into db
Added db reference and creates array to later input into db