Updates and various fixes

Wishing I could understand half this scripting so actually could fix and enhace this properly not leaving so many bugs and holes.