adding logic