Changed methods to generators
added fromscalar classmethod