fixed lots of bugs. finally ready for syncing