reworked api calls, added tests
fix undefined variable err
remove pry