clean up dart code
simplify code layout and only export needed functions