sam_modules added; subroutines for taking input and opening file