proper js prototype design