My own implementation of algorithms