Add support for default users and realm configuration. Few other improvements