Misery regarding function extraction (wrong ids & newlines)