Aarex's code cleanup