Function update(not finished yet)