Refactor code, breaking changes reverse the parameter order and add pretty print.