use $GLOBALS['cfg'] instead of parsing $cfg variable among methods
renamed methods to better reflect their usage.
changed comments to better reflect the origin of the parameter $selected