add balanced payments code. Additional minor frontend work