cleaned up and generalized