Initial merge of Sokil and Mongolid, with a few things refactored
A few refactorings to the Sokil and Mongolid elements