bug fixes and optimizations: tRemaining