Initial import
A couple of fixes and a cleaner interface