Making things a bit more strict

Making the script a bit more strict, removed duplication of variables.