modified update function to be correct use of setTimeout, added rest of files