Additional Clean-up and generalization