work in progress - adding specs and refining controller code