fix bug in min/max implementations
rearrange files into directories