- massive refactoring
- various bugs fixed