switched to a more object oriented style