Improved performance (replaces reverted 1d5c231)