Refactored and fixes 2,10,26