Pushing stuff out of update and into functions

Signed-off-by: Ancients <Ancient123@gmail.com>