Formatted Lukas' code