Split things up so I can test it to debug issues