incorporating lots of library changes