added some line breaks and new functions from SR2 code generation