Added random option; better error handling; more sample files; minor fixes