added controller logic