code clean-up / optimization

- cleaning up some code
- speeding up some of the string concatenation