Create unit tests
Tests-inspired fixes