working on controller logic