const-ify library code