This seems to be repeated 3 times with different variables and is a good candidate for refactoring.