Cleaned up matches, fixed nonetype error