Refactoring of layout and addition of tests for the functionality provided