Refactor teamocil