raising difficulty to 16 and some refactoring