Moved functions into Opt class