Cleaned up some code, fixed some syncing issues.