Refactored using prototype pattern