Added canvas resize function

fixed bugs, canvas resize testing succesful