Removed an extra print and commented-out code. Moved the magics regexp to the start of the module so that it is not compiled each time