Fixed implicit declaration warning
Code style tweak
Replacing "Shlemiel The Painter" algorithms

with more sensible alternatives