Refactor for better maintenance and to ease future enhancements. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>