Improved parsing of server response