Changed hardcoded table names to variable ones