Implemented weight function. Changed readme to have subheaders.