Added selection and memory leak detector/fixed