Add more 3rd party libraries and refactor a bit.