Use lexcial_cast instead of C-style casting.
Removed regex hot-spot in TraceLine. Misc refactoring.