Remove nested functions and comments