Added support for alignment of text. Any text after the ^l symbol will be aligned to the left, after ^c will be in the center and after ^r will be to the right.

I also rearranged the loop slightly.