Made it work properly