rewrote in class structure