changed scalar to double