Added handling of nested withs in pre-process