Added weight module for sorting. Ticket #139.

Please Review @Luukyb. Thanks.