Improve "animation" function