Remove spagetti code