Working version compatible with WordPress 3.5.1