added external libraries, and some code