had variable names mixed up