rdata command works; some code cleanup