Updated with more modularity and a repl