fixed long chain of if/else