updated code from Euler Spring meetup