Kept updating functions to try and make them faster