Added sources number configuration and requestAnimationFrame
Memory optimization and refactoring