basic controller logic