Replaces C# logic with javascript.