massively refactored, new features added