controller logic