More efficient preprocessing for discapnet. Fixed memory issue.