added slightly more controller logic