Patches from Battler and Tom

Improved version as well :)