Improved hw_expandtabs implementation