fixed precission error, minor refactors