straight vanilla ruby implementation of updown