Rewritten with new features