more work; implemented simple state achine; created direction functions removed signal normalisation