added controller tests and some improvements