complitely rewritten