many changes and fixes, lost track of what's what