Refactor code for VS2013