rewrote into a class