fix comma and bracket placement
A little bit of refactoring after experimenting.