Refactor hclone

Break out individual parts into functions