Refactor using keyframes