Rewrote to use classes