Updated to have compatibility with PHP versions below 5.5