Moved cache method to Environment
Remove unnecessary preg_match
Proper indentation