Fixed endianness of port
Moved histogram function to Stats module