fixing up code to improve testing