Add tests
Reduce/remove unsafe functions (if possible)
