moved more code from gamemap to layer