+added double logic, comments