now working as it should