sync
tk sage sim v2.: Complete rewrite from previous version