Clean up map object and layer code