Vastly improved memory usage at the cost of a few CPU cycles
Fixed compilation issues caused by last commit