Many fixes, refactoring