Updated and cleaner version.