Remove unused sample-files. Add exception handling and null-checking.