Fixed performance issues and set max fps with a timer