removed test logging and updated math