Refactors code structures