started rewriting in golang