more improvements to memory allocation and removed verbose print stmts