caught bug in rb; various style improvements