Started testing, check and refactor. Fix IP address bug when registering to main server.