working out some bugs