now works and uses vectors