added new features Still deadlocks needs fixing