Clean up index.php and remove all usages of write_socket and replace with functions that abstract basic IRC functions like nick changes, connection registration and identifying.