restructured to make it more go friendly