Friction

- Added working friction
- Optimized loops