Update function working. Separates business logic functions into new file.