Home-rolled implementations of various algorithms