Finished moving logic to server side. removed unused stuff.