Code restructured and new features