Refactored to simplify design pattern