Very much hacked together, and a work in progress for now.