partially start work on register function