Refactor and extend (pair progamming with Mo).