program is working as intended now