moved delegation funtion to common.js