added ds label as paramter, cleaned up code