more repackaging, cleaned up comments/code further