Changed vectors to pass by reference