This was my original implementation. Unfortunately, the double type caused some tests to fail in ways I did not have the knowledge to fix.