refactored a lot of stuff, added some tests & made some visualizing