moved toDot method to separate class