Refactored with prototypes