Removed faulty finish() call
Added register function