refactor and add ability to register valid token