This code is repeated below 2 more times. Why not refactor?