restructurize code