Updating code for use in .net fiddle