Changed activity recognition frequency to be adjustable. Changed state machine rules a bit.