Implemented stopping function

And some minor fixes:
* Added more TODOs
* Fixed some typos + indentation