Modified View controller with correct flipCount function