Fixed access issues and extracted utility functions.