Simplified serial implementation.