some more cleanup of code