Moved pre module to lib, rewritten as a class