Made some updates and added unit tests for lib/hooks