Halo: bugfixing and code cleanup