removed unnecessary 'case's + logic bug fix