improved the sample loading and added tests