Lot of fixes and extensions