User rewrite

Api part for user rewrite, only some changes