refactor checkout and return library methods