moved update function to public methods