Fixes all tests and refactors common astyanax utilities