works for small maps