Refactors the code and initiates better ui use