Changed structure of TOA calculation and output.