improving code: removed unwanted conditional structure