improve by adding condition