Code Cleanup and bug fixes for HF and LLGC