Added db reference and creates array to later input into db