Added network stuff

Added network stuff so now the casting table is synced between server
and client. The casting table can now also accept amalgam and will
display correctly.
Cleaned up some code