Using String.format() now instead of String.replace for formatting Strings. Optimized and cleaned up code