refactoring and fixes of 1st goal