possibly smarter code