correctly if/else and properly check containers