Fix dialyzer errors, clean-up return types and change public API function names to erlang-style names.