Trying to make this more oo and streamlined - not enough testing, yet