general revision, some bug fixes
general revision, some bug fixes