Many fixes. Added syncronization. Still has some parts that are not working.