abstract common stuff to base.js