Consistently use tab throughout all the files, removed whitespace.
fixed issue where a statement would be sent twice.
added some documentation.