Refacted ANSI Control Codes code.

Added helper functions to move cursor around instead of doing math each
time.