updated libraries, adapted code