remove unused ds module
clarify stock indexing, and fix a couple of bugs