added oom sleep mode, rebased some functions