First implementation. Fully functional