First pass at behaviors and locals implementation

also updated for M5