this is a js design pattern practice