Moved canvas setup into a callback