Optimize and cleanup
Fix spike handling