pocket detection stuff