merge with Steve code, added Api key auth for HP, some errors not fixed