updated libraries, further cleanup of code