numerous bug fixes and feature additions