removed unnecessary get_format() function plus some refactoring