implemented cascading elsif