refactored everything for twbs 3