simpler
using double for length