Cleanup from the basic POC code to something a bit more elegant