latest index.cgi

including sample file but not finished
add sample, remove duplicated code