Extensive set of fixes