append controller to mainjs if second param is defined