Greatly improved code layout