Improvement to 5e77d2e commit and incude some docblock.

Signed-off-by: crynobone <crynobone@gmail.com>