Improve HWA code