use a class to reduce code duplication
adding comment