Rubik Cube Animation

I am animating a Rubik cube for a buddy but the rotation is not working properly. I do not have my model rigged to anything, I am simply selecting the desired blocks and rotating them in the environment. When I go to insert the keyframes I apply locrotscale, but the blocks spin out of control and in paths that they should not take, passing through other pieces of the Rubik cube. Does anyone know a solution? Should I rig the model up? If so, how should I go about that? If not, how can I rotate the cubes so it actually looks like how a Rubik cube should work?