big improvements: recursive imports, check for undefined variables