brach unit code finished. Untested yet