Refactoring layoutu javascriptu