Re-factor most of the functions using the new flow...