API modules code revised (duplication of code solved)