eliminated str conversion and nested condition