Code re-formatted
Added weight field