complete add book function