Fix bug in last commit
Improved processing of flags and added --visual flag.