improved logic of behaviors and blocks