Efficient Balancing Techniques For Q-Ary Codes With Error Correction Capabilities