fix formatting, add tests