Minor Speed improvements and re-structuring