Refactor code - use const where appropriate