Changed some classes to be more close to the functional way of implementing things.