Rewrote controller logic for new version.