Should break this out into a method.