Created class and functors to simplify things.