added registration handler and put excpetions in their own file