Cleaned up mapGen code