Fixed FlagController, added unit tests, refactor externalId to callerId