Clean up the getCanvas method, retrieve width and height programmatically