abstracted image processing routines out of update to sepearate functions and added UI