make functions const where possible

5 jobs for master in 2 minutes and 34 seconds (queued for 8 seconds)