Nearly close to v0.2, elimitated most splint warnings and fixed a few bugs