added start.pl and simplified code