added if/else blocks