refactored controller to make sure no. of true and no. of false are updated