Correct indentation
Use JSfuncs.stackrestore instead of duplicating its code