adding sub routines for api processing