Iniital test coveraga and refactoring