Fixed the tw command, and other minor improvements