implemented controller logic