created getPerfect() method and reworked the main() method