first commit; poached from old api repo