Clean up the code. Need to fixe memory issues.