Changed createUnit into static factory method Unit::create.