Updated logic