add verbose flag and better exception handling