some fixes and extensions, more theory for spec