Refactor. Move drawing logic into rbdraw.js