timing of pulses update

Code cleaned a bit (still pretty dirty)
implemented different phases of pulses (X and Y are now different), no
optimal functionality that is next step
timing of beginning and edge pulse and cutting of edges of central
element is now functional.