added example + checking for return code