Fixed extent
Other fixes
Refactoring