main changed to use doubles