Fixed a few things. Now works but still has freezing problem related to svr