added some warning flags, and refactored opt parser