Minor cleanups

Use string.format instead of regular concatenation and str() calls.
Added constants instead of inline strings.