added Math.abs to subdomain index calculation