some simple beat algorithm almost done