Reorganized functions for clarity

Functions are now listed in the order that they are referenced.
Rename scnt to separator_count

Clear variable names are preferable.