Added chunks of library code