Working version --without exit