tried to organize the sources in a more Go-like way