Some interface changes and a lot of fixes