Final code. It works now :)