refactor and build for vs2013