changed Closing to be more modular and use maps to increase performance