A play around with design patterns in JS