I think this there's a lot of opportunity  in this file to refactor this in a way that is reusable? @stenington what are your thoughts?