Add memory size params and clean up template

Make memory usage adjustable via parameter