More tests, some refacatoring considering floating point calculation