Move update code out of home page method