modified version for vs2013