Define recurisve alive function