bedtime fixes / refactor