started optimizing memory because it often crashes with heap spaces errors.