Fixed dialyzer warnings, added specs and documentation.