big changes to allow better implementation of library.