Did a little cleanup and generatlization.