updated choosebook.py

cleaned it up, made it more efficient, and separated it into separate
functions