starting to define sopen function