Debugged several implementation flaws