refactorings.

malloc in processes doesnt work yet.