Changed to use arrays instead of individual variables