test added but not finisehd and some code refactoring followign test