moved update function out to add to prototype