Updated with solution that is compatable with VS2012