Added some profiling and fixed bugs, bug fixes should go in streamlining