tests and added logging to API