improved organization and added colorRectLayer