First working conditional version