- Reordered operations
- cleaned up scala code