Fixed bugs and added the final mod checking stage. Works pretty well for an initial implementation.