added ratio format
refactoring teh code