Added automatic scaling of canvas