third attempt, think I solved it