loop detection added to parser + math example added