added two methods for code registration and tested them