now class works properly