corrected init to utils refactorization
fixed MAJOR bug in memory allocation. added memory cleanup to main.