Changed magic number 5 to a constant in solution 1