Tests and restructuring