finished registration but have to debug and optimize