Completely rewritten. Better optimization for mobile devices.