fix things, refactor database access, update mapbbcode