code cleanup and -v option