moving up catching exception to be more effective