Changed the program so it (kind of) works with a database NOTE: Most of the tests fail beacause implementation is different.