I just moved this code out of update