I'm not really sure what you mean. Do you think it would be better to abstract this into it's own function?