correcting and adding register logic