changed to work with double