completely rewritten