Slight cleanup and fixed a rather silly logic bug that rendered the module basically unusable.