updated to handle floating point properly (more or less)