Performance improvements /code cleanups