changed all double to fptype