Updated Master and Module

Cleaned the code a bit, improved error messages.
Thanks to TheOriginalBit for help!