This Long part of the code is a duplicated part of something else, isn't it?  Would it make sense to create subfunction with the name of what is doing?