Updated the variables and resolved some warnings