refactored code, now uses std function in module
updated comments
Signed-off-by: Brian Coca <briancoca+dev@gmail.com>