finalized implementation of custom format and several fixes