Move maps code to library.