Optimized memory usage (rev. 7)

Signed-off-by: nixnodes <code@eth.si>