Added POSITION struct to hold line positions.
Fixed bug when trying to pop message.
Added optimizations.
Formatting.