pasting in manual fixes
post-merge from upstream, very breaky
fixed lint errors
working on passing tests