Make functions const if needed and reformat the code using clang-format. Change-Id: If2848ef6c3b61df5358286687d80213533125856