Bug fixes and better implementation for mtsoft