Test and main code