ruby: major overhaul