Modifications for less memory consumption