Global changes

Correct mistake with stack
Changes in way of clearing memory