FUTURE ERIC - Make this code not so awful (especially that export code...good golly)