Fixed performance bugs in Processing sketch