cleaned-up version