Correct secl sanity counter function
Various minor optimisations - Replace custom divide operation with div
ini cleanup