refactoring + got coinbase working