Fixed severe bug in counter getting stuck.
Added brackets to trimming.
Improved documentation