Fixed stack. More elegant code aswell.