refactor adminport to make it more generic and flexible