updated for generalization
cleaned up a bit more in the description