minor changes to make it more OO