Switched to using a mode array
Code cleanup
Added trivial CLI
Added pattern arguments