Breaking the update up into several utility functions.