make pretty, add comments and change to idioms