added some conditionals