added verbose option, restructured functions