Some refactoring, and ensure captures work