prettified code and some spec improvements