pulled out ensure func