reduce minified size
add jsDoc types
minor code reformat