various bug fixes

Also began preparation for header-heavy transition