refactor some duplicated stuff in constants, and add docs to constants missing docs