Added var dec management and small change to error so it says what type