adding tests and implementing all functionality except once