major commit with lots of fixes