Add comments and wrap opts in try block
Add tests for utility functions