update function - potentially working now.