redid colorize, pass in text, get colored text back

- Moved all of the ANSI stuff up to the top of the script
- Added 'local' keywords to all local function variables
- Quoted arguments to all local function variables