Add some better doc and comments