GH-2 Added recursive functions for value flow cheks
GH-2 Cleaned up code