Code fixes to implement controller logic