refactor books app