changed function to wei