prettified code for the update sprite function