Modified some API to add proper constant correctness