Improved HxObject generation
Tidied up