statistics very close to work (accepted). cleaned up code