Got it to work but not efficient