several key changes and bug fixes