factored y-axis inversion logic into function
minor changes to tests in line with github comments