first implimentation is written