Code made a bit cleaner and % added as an operator