Some code optimizing and function separating

In preparation of moving bar art updates to a separate timer