Fixed singularities and removed stupid optimisations