bug fixes, minor structural tweaks. WIP!