Added support for Safari and code optimization