writing tests, polishing up