refactoring api kernal to work for html also

Signed-off-by: RJ garcia <rj@bighead.net>