This looks like block of code previously -- possible to encapsulate somehow?