many bug fixes / clean up