refactor code; vcr tests