Memory leak fixed + conditional becnhmarking