A lot of fixes and additions