Split long lines, and added brackets

Added brackets where needed, and split long lines to make the code more
readable.