added some commenting to make use of generic functions a bit less obscure.