Edited statemachine to basec mapping - partially working.