Way too many repetitions here, and too many hardcoded numbers.