Some initial work to make this a gem

Anyway I look at it, a gem will just be the easiest way to go.