Reorganize code further