Updated code. Removed old variables.