Reorganize code with extensions