Made updating the library a function so that it can be called on successful database add
Fix sprayReader scoping issue