this took a while