some refactoring to remove 'else' and 'return' where it isn't needed, also added a test to check if 2 is a prime number