Adding isLeft and isRight helper functions