Advanced/debugging/upgrades

Just some minor upgrades and fixes.