removed null pointer and number format exceptions, changed representation of cyle to a double