working on register handling