made register function work