restructure application into a gem! hooray!