Integrated the work @pma did and brought previous APIs