refactoring and paddings with  tests