Small fixes and speed upgrades