Refactoring mainly, added a few new libraries