implemented register function