Tests for Phone Application, refactoring code