improved UI, refactored to match developing C# code
implemented Rule3 in C#