First working implemenations with tests