added local libs
improved code