Converted variables to array for tidier code