functioning register function, new wrappers and improved style